package com.shuzijun.leetcode.editor.cn;

import java.util.HashSet;

public class ShuZuZhongZhongFuDeShuZiLcof{
    public static void main(String[] args) {
         Solution solution = new ShuZuZhongZhongFuDeShuZiLcof().new Solution();
    }
    //leetcode submit region begin(Prohibit modification and deletion)
class Solution {
    public int findRepeatNumber(int[] nums) {
        HashSet<Integer> set = new HashSet<>();
        for (int i = 0; i < nums.length; i++) {
            if (set.contains(nums[i])) {
                return nums[i];
            }
            set.add(nums[i]);
        }
        return -1;
    }
}
//leetcode submit region end(Prohibit modification and deletion)

}